/*
 * =====================================================================================
 *
 *       Filename:  state.h
 *
 *    Description:  
 *
 *        Version:  1.0
 *        Created:  02/16/2011 05:16:21 PM
 *       Revision:  none
 *       Compiler:  gcc
 *
 *         Author:  dp (8023), dp8023@gmail.com
 *        Company:  
 *
 * =====================================================================================
 */

#ifndef _STATE_H_
#define _STATE_H_

#include <iostream>

using namespace std;

#define	MOON		12
#define	AFTERNOON	13
#define	EVENING		17
#define	NIGHT		21

class studytime;

class state
{
	public:
		virtual ~state(){}
		virtual void studystate(studytime *time) = 0;
};

class morningstate:public state
{
	public:
		void studystate(studytime *time);
};

class noonstate:public state
{
	public:
		void studystate(studytime *time);
};

class afternoonstate:public state
{
	public:
		void studystate(studytime *time);
};

class reststate:public state
{
	public:
		void studystate(studytime *time);
};

class sleepstate:public state
{
	public:
		void studystate(studytime *time);
};

class eveningstate:public state
{
	public:
		void studystate(studytime *time);
};

class studytime
{
	public:
		studytime():m_curstate(NULL),m_curtime(0),m_finish(false)
		{
			m_curstate = new morningstate();
		}
		int getcurtime()
		{
			return m_curtime;
		}
		void setcurtime(const int time)
		{
			m_curtime = time;
		}
		bool isstudyfinished()
		{
			return m_finish;
		}
		void setstudyprogress(const bool finished)
		{
			m_finish = finished;
		}
		void setstate(state *p_state)
		{
			m_curstate = p_state;
		}
		void studystate()
		{
			m_curstate->studystate(this);
		}
	private:
		state *m_curstate;
		int m_curtime;
		bool m_finish;
};

#endif

